<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        class EventBus {
          constructor() {
            this.store = {}
          }
          $on(eventName, callback) {
            // if (typeof callback !== 'function') throw new TypeError( eventName + 'is not a function')
            this.store[eventName] = callback
          }
          $emit(eventName){
            const args = [...arguments].slice(1)
            this.store[eventName](...args)
          }
        }

        const mitt = new EventBus()

        mitt.$on('getArguments', (a) => {
          console.log('get', a)
        })
        mitt.$emit('getArguments', 10)   
    </script>
</body>
</html>